package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.recharge;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Objects;

@Data
public class PayWalletRechargeCreateReqVO {

    @Schema(description = "会员id",  example = "1")
    @NotNull(message = "会员id不能为空")
    private Long userId;

    @Schema(description = "支付金额",  example = "1000")
    @Min(value = 1,  message = "支付金额必须大于零")
    @NotNull(message = "支付金额不能为空")
    private Integer payPrice;

    @Schema(description = "赠送金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
    private Integer bonusPrice;

    @Schema(description = "充值套餐编号", example = "1024")
    private Long packageId;

    @AssertTrue(message = "充值金额和充钱套餐不能同时为空")
    public boolean isValidPayPriceAndPackageId() {
        return Objects.nonNull(payPrice) || Objects.nonNull(packageId);
    }

    @Schema(description = "店铺id", example = "1024")
    @NotNull(message = "充值店铺id不能为空")
    private Long tenantId;

    @Schema(description = "艾灸师id", example = "1024")
    private Long masterId;

    @Schema(description = "是否首充", example = "1024")
    private Boolean isFirst;
}
